home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / UTILREEN / NEWKEY.LZH / NEWKEY54.EXE / EXAMPLE.KEY < prev    next >
Text File  |  1990-10-27  |  13KB  |  296 lines

  1. * This macro file illustrates many of the various functions that can be
  2. * done in Newkey.  These macros are designed to be run from the DOS command 
  3. * line.  
  4. *
  5. * CED should not be loaded (if you don't know what CED is then don't 
  6. * worry, you don't have it).
  7. *
  8. * Illustrates if functions - This macro will do a "dir/p" and clear 
  9. * all "Stike a key" messages until the directory listing is done.  It does
  10. * this by starting the directory listing and then calling <chkdir1> to
  11. * do rest of processing.
  12. {begdef chkdir}dir /p<enter><chkdir1>
  13. {enddef}
  14.  
  15. * Part 2 of if function example - Logic is as follows:
  16. *
  17. *  Wait for 1/2 second to give directory listing time to fill screen
  18. *  If "bytes free" displayed then exit, directory listing is done
  19. *  If "Strike a key" displayed, then screen is full, "strike" the enter
  20. *  key to continue.
  21. *  Branch to start of macro to repeat process
  22. {begdef chkdir1}
  23. {wait 00:00:50}
  24. {ifefscr}bytes free{endifef}{return}
  25. {ifefscr}Strike a key{endifef}<enter>
  26. <chkdir1>
  27. {enddef}
  28.  
  29. * Illustrates print screen function
  30. {begdef prtscrn}Print screen{prtscrn}
  31. {enddef}
  32.  
  33. * Illustrates beep function
  34. {begdef beep}Beep now{wait 00:00:30}{beep} beep done<esc>
  35. {enddef}
  36.  
  37. * Illustrates cls the clear screen function
  38. {begdef cls}Clear the screen {cls} clear done<esc>
  39. {enddef}
  40.  
  41. * Illustrates the cursor on and off functions
  42. {begdef cursor}Turn the cursor off {cursoff} press any key to continue
  43. {waitany}<esc>
  44. Turn cursor back on {curson}
  45. {enddef}
  46.  
  47. * Illustrates date and time function formats
  48. {begdef date}<esc>cls<enter>
  49.           Sample Date Functions                            <esc>
  50. template               what Newkey returns                 <esc>
  51.  
  52. mm/dd/yy                {date}mm/dd/yy{enddate}            <esc>
  53. yy/mm/dd                {date}yy/mm/dd{enddate}            <esc>
  54. mm-dd-yy                {date}mm-dd-yy{enddate}            <esc>
  55. mm/dd/yyyy              {date}mm/dd/yyyy{enddate}          <esc>
  56.                                                            <esc>
  57. mmmm dd, yyyy           {date}mmmm dd, yyyy{enddate}       <esc>
  58. mmm dd, yyyy            {date}mmm dd, yyyy{enddate}        <esc>
  59. dddd, mmm dd, yyyy      {date}dddd, mmm dd, yyyy{enddate}  <esc>
  60. ddd, mmm dd, yyyy       {date}ddd, mmm dd, yyyy{enddate}   <esc>
  61.    <esc>
  62.           Sample Time Functions    <esc>
  63.  
  64. template     what Newkey returns             <esc>
  65.  
  66. hh:mm:ss     {time}hh:mm:ss{endtime} = twelve hour clock time <esc>
  67. hh:mm xx     {time}hh:mm xx{endtime} = twelve hour clock time <esc>
  68. hh:mm XX     {time}hh:mm XX{endtime} = twelve hour clock time <esc>
  69. tt:mm:ss     {time}tt:mm:ss{endtime} = 24 hour clock time    <esc>
  70. <esc>
  71. Press any key to learn how you can create your own date and time 
  72. macros.{waitany}
  73. <ESC>
  74. {cls}
  75. Using the basic building blocks of the date and time functions you   <esc>
  76. can build your own date/time template.  Just type these as you would <esc>
  77. like to see them when they are played back.  You are not limited to  <esc>
  78. just these building blocks.  Any characters found in the date/time   <esc>
  79. function which can not be interpreted as one of the building blocks  <esc>
  80. will be returned just as they are.  This means that you have complete<esc>
  81. flexibility in creating your own date/time function.                 <esc>
  82.                                                                      <esc>
  83. Time functions                      Date functions                   <esc>
  84.                                                                      <esc>
  85. hh = hours on twelve hour clock     dd = day                         <esc>
  86. mm = minutes                        mm = month                       <esc>
  87. ss = seconds                        yy,yyy,yyyy = year               <esc>
  88. tt = hours on 24 hour clock         ddd,mmm = 3 char abbreviation    <esc>
  89. xx = am,pm                          dddd,mmmm = full name            <esc>
  90. XX = AM,PM                                                           <esc>
  91. {enddef}
  92.  
  93. * Illustrates begprint function
  94. {begdef print}send something to printer on LPT1
  95. {begprint}hello world!<enter>{endprint}<esc>
  96. {enddef}
  97.  
  98. * Illustrates setting caps lock
  99. {begdef caps}save caps lock status{capssave}<esc>
  100. turn caps lock on{capson} - type abc {ffld}{ffld}{ffld}<esc>
  101. turn caps lock off{capsoff} - type abc {ffld}{ffld}{ffld}<esc>
  102. restore caps lock status{capsrest}<esc>
  103. {enddef}
  104.  
  105. * Illustrates setting num lock
  106. {begdef num}save num lock status{numsave}<esc>
  107. turn num lock on{numon} - type 123 on numeric keypad {ffld}{ffld}{ffld}<esc>
  108. turn num lock off{numoff} - type 123 on numeric keypad {ffld}{ffld}{ffld}<esc>
  109. restore num lock status{numrest}<esc>
  110. {enddef}
  111.  
  112. * Illustrates setting scrl lock
  113. {begdef scrl}save scrl lock status{scrlsave}<esc>
  114. turn scrl lock on{scrlon} - no way to demonstrate from dos command line<esc>
  115. turn scrl lock off{scrloff} - no way to demonstrate from dos command line<esc>
  116. restore scrl lock status{scrlrest}<esc>
  117. {enddef}
  118.  
  119. * Illustrates time function
  120. {begdef time}current time is {time}hh:mm:ss xx{endtime}<esc>
  121. {enddef}
  122.  
  123. * Illustrates available set options
  124. {begdef setopts}Merging example.key
  125. {begmerge}example.key{endmerge} Merge is done<esc>{enddef}
  126.  
  127. * Clearing macros from memory
  128. * This macro will clear all macros from memory except for guarded macros
  129. * and the macro being used to call it.  It will take longer than the same
  130. * function done from the menu.
  131. {begdef clear}Clearing macros from memory
  132. {clearmac}Clear is done<esc>{enddef}
  133.  
  134. * Merging a macro file
  135. {begdef mergfile}Merging example.key
  136. {begmerge}example.key{endmerge} Merge is done<esc>{enddef}
  137.  
  138. * Merging a macro file overwriting duplicates
  139. {begdef mergovrw}Merging example.key overwriting duplicates
  140. {begmergo}example.key{endmergo} Merge is done<esc>{enddef}
  141.  
  142. * Loading a macro file
  143. {begdef loadfile}Loading example.key
  144. {begload}example.key{endload} Load is done<esc>{enddef}
  145.  
  146. * Saving a macro file
  147. {begdef savefile}Saving example1.key
  148. {begsave}example1.key{endsave} Save is done<esc>{enddef}
  149.  
  150. * used for translation bypass demonstration
  151. {begdef &}Hello!{enddef}
  152. {begdef alt0}level0{enddef}
  153. * nested macro demonstration
  154. {begdef alt1}level1<alt2>{enddef}
  155. {begdef alt2}level2<alt3>{enddef}
  156. {begdef alt3}level3<alt4>{enddef}
  157. {begdef alt4}level4<alt5>{enddef}
  158. {begdef alt5}level5<alt6>{enddef}
  159. {begdef alt6}level6<alt7>{enddef}
  160. {begdef alt7}level7<alt8>{enddef}
  161. {begdef alt8}level8<alt9>{enddef}
  162. {begdef alt9}level9<alt0>{enddef}
  163.  
  164. * clear screen demonstration
  165. {begdef altf1}{cls}    Clear screen macro demonstration    <esc>
  166. <esc>I am going to clear your screen.  Press any key when you are  
  167. <esc>ready.{ffld}{cls}Newkey can clear your screen whenever you wis
  168. h.{enddef}
  169.  
  170. * beep demonstration
  171. {begdef altf2}{cls}<tab>  Beep macro demonstration    <esc><esc>I 
  172. am going to beep. {beep} Newkey macros can beep {beep}<esc> wheneve
  173. r you wish.<esc>{enddef}
  174.  
  175. * screen off/on demonstration
  176. {begdef altf3}{cls}<tab>  Screen off macro demonstration    <esc>
  177. <esc>I am going to turn the screen off when you hit enter.  To turn
  178.  the screen <esc>back on press any key a couple of times.  Press en
  179. ter when ready.{vfld}  <esc>{scroff}{ffld}{ffld} <esc><esc>Now I'm 
  180. going to turn off the screen for 3 seconds and then turn it on. 
  181. <esc>Press any key when ready. {ffld}{scroff}{wait 00:03:00}
  182. {scron} <esc>{enddef}
  183.  
  184. * 5 second time delay 
  185. {begdef altt}<esc>{set slowtype off}5 second time delay begins now:
  186. {wait 00:05:00}
  187.  and ends now. <esc>{enddef}
  188.  
  189. * Macro which calls itself
  190. {begdef ctrlw}<esc>{set slowtype on}Hi! I'm <caps,>ctrlw<caps.>.  I will ca
  191. ll myself over and over until you <esc>stop me by pressing <caps,>c
  192. trlesc<caps.> (ctrl\ for enhanced), the   <esc>Newkey cancel key.  
  193. <esc>I will type slowly since I have turned on slow typing mode so 
  194. that <esc>you can follow what is happening.<esc><esc><ctrlw>
  195. {enddef}
  196.  
  197. * Fixed Length Fill-in-the-blanks Pause Demonstration
  198. {begdef f1}{cls}{set slowtype off}       Fixed length fill-in-the-blanks de
  199. monstration  <esc><esc>Enter 2 keystrokes: {ffld}{ffld} and Newkey 
  200. will finish for you.<esc>{enddef}
  201.  
  202. * Playback multi-character macro demonstration
  203. {begdef f10}{cls}<esc><esc><esc><esc><esc><esc><esc>
  204.     Playback multi-character macro demonstration    <esc>
  205. To play back a multi-character macro, follow these steps:  <esc><esc>
  206.    1.  Press <caps,>alt,<caps.>           <esc>
  207.    2.  Type in "multimac"     <esc>
  208.    3.  Press enter            <esc>{enddef}
  209.  
  210. * Variable Length Fill-in-the-blanks Pause Demonstration
  211. {begdef f2}{cls}{set slowtype off}     Variable length fill-in-the-blanks d
  212. emonstration <esc><esc>Enter any number of keystrokes followed by e
  213. nter: {vfld}   <esc>and Newkey will finish for you.      <esc>
  214. {enddef}
  215.  
  216. * Translation Bypass Demonstration
  217. {begdef f3}{cls}{set slowtype off}        Translation bypass demonstration 
  218.    <esc><esc>Enter '{notran &}' followed by enter: {vfld}<esc>You will
  219.  notice that '{notran &}' has been redefined to 'HELLO'.<esc>Now enter
  220.  ctrl-2 and '{notran &}' followed by enter: {vfld}  <esc><esc>You will
  221.  notice that '{notran &}' was returned, not 'HELLO'.  <esc>This is an 
  222. example of Newkey's translation bypass feature <esc>{enddef}
  223.  
  224. * Time Delay Demonstration
  225. {begdef f4}{cls}{set slowtype off}             Time delay demonstration    
  226.     <esc><esc>
  227. Enter ALT T.  Newkey will wait for 5 seconds before continuing. <esc>
  228. You will notice that the cursor has become a fat bar. <esc>{enddef}
  229.  
  230. * Dynamic Display Feature Demonstration 
  231. {begdef f5}{cls}{set slowtype off}
  232.             Dynamic display feature demonstration:            <esc><esc>
  233. Enter CTRL / (ALT / for enhanced).  
  234. This will allow you to invoke several <esc>Newkey functions without
  235.  leaving your current program.          <esc><esc>This feature is a
  236. lways available, no matter what program <esc>you are in.  When you 
  237. are finished Newkey will restore <esc>your screen exactly where you
  238.  left off.    <esc>{enddef}
  239.  
  240. * Slow typing mode demonstration
  241. {begdef f6}{cls}{set slowtype off}                     Slow Typing Mode Dem
  242. onstration            <esc><esc>{set slowtype on}Slow typing mode has just b
  243. een turned on.  You will notice how <esc>slowly Newkey is typing.  
  244. Now we will turn slow typing off.{set slowtype off} <esc>Notice how quickly 
  245. Newkey is typing.  Much too fast for you <esc>to follow what is hap
  246. pening.  <esc>{enddef}
  247.  
  248. * Defining macro within macro demonstration
  249. {begdef f7}{cls}{set slowtype off}<esc><esc><esc>           Defining macro 
  250. within macro demonstration            <esc><esc>This macro will def
  251. ine <caps,>ctrlq<caps.> to be whatever you type in.  <esc>Type what
  252. ever you want to and when you are done press <esc><caps,>alt-
  253. <caps.> to end it. Start now:         <esc>{begdef ctrlq}<esc>Now 
  254. that you have finished, press <caps,>ctrlq<caps.> and watch <esc>wh
  255. at you typed in returned.  Newkey will press it for  <esc>you first
  256. :<esc><ctrlq>{enddef}
  257.  
  258. * Macro calls Itself and Cancel Newkey Demonstration
  259. {begdef f8}{cls}{set slowtype off}   Macro Calls Itself and Cancel Newkey P
  260. rocessing Demonstration<esc><esc>Press <caps,>ctrlw<caps.>.  This w
  261. ill start a macro which calls itself.<esc>This macro will continue 
  262. to execute until you press the Newkey<esc>cancel processing key, 
  263. <caps,>ctrldel<caps.> (ctrl\ for enhanced).  <esc>This key cancels 
  264. all current Newkey processing and clears the keyboard <esc>buffer. 
  265. Newkey will press <caps,>ctrlw<caps.> for you.<esc><ctrlw>{enddef}
  266.  
  267. * Macro which calls Newkey's dynamic display features
  268. {begdef f9}{cls}{set slowtype off}       Macro which calls Newkey's dynamic
  269.  display features<esc><esc>This macro will actually invoke Newkey's
  270.  dynamic display features <esc>to automatically change one of the N
  271. ewkey parameters.  In this <esc>case we will turn off the screen sa
  272. ver.  Press any key when you <esc>are ready.{ffld}<esc>{cmd}4pn
  273. <esc><esc><endcmd><esc>That was easy wasn't it.<esc>{enddef}
  274.  
  275. * Multi-character macro
  276. {begdef multimac}<esc>   Hi!  I'm a multi-character macro named "m
  277. ultimac".  I am used<esc>by <caps,>f10<caps.> to demonstrate multi-
  278. character macros.<esc>{enddef}
  279.  
  280. * Multi-character macro which calls itself
  281. {begdef recurmac}<esc>{set slowtype on}Hi! I'm <caps,>recurmac<caps.>.  I w
  282. ill call myself over and over until <esc>you stop me by pressing 
  283. <caps,>ctrldel<caps.> (ctrl\ for enhanced), the  <esc>Newkey cancel
  284.  key.  <esc>I will type slowly since I have turned on slow typing m
  285. ode so that <esc>you can follow what is happening.<esc><esc>
  286. <recurmac>{enddef}
  287.